package StringDemo.CompareString;
import java.util.Scanner;

public class Example {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String userNme = "User1";
        String password = "Abcd1234";
        for (int i = 0; i < 3; i++) {
            System.out.println("请输入用户名");
            String importUserName = sc.next();
            System.out.println("请输入密码");
            String importPassword = sc.next();
            if(importPassword.equals(password) && importUserName.equals(userNme)){
                System.out.println("登录成功");
                break;
            }else
                System.out.println("密码错误");
            if(i == 2)
                System.out.println("登录失败");
        }

    }
}
